package com.antler.smt.admin.utils;

import com.antler.smt.utils.SendMailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 日志封装类
 *
 * @author vic
 * @date 2018-03-20 19:43
 */
@Component
public class MailUtil {

    /**
     * 邮件发送者
     */
    @Autowired
    private JavaMailSender mailSender;

    /**
     * 发件邮箱
     */
    @Value("${spring.mail.username}")
    private String mailFrom;


    /**
     * 发送简单邮件
     *
     * @param receiver 收件人地址
     * @param subject  主题
     * @param content  内容
     */
    public void sendSimpleMail(String receiver, String subject, String content) {
        SendMailUtil.sendSimpleMail(mailSender, mailFrom, receiver, subject, content);
    }
}
